<!DOCTYPE html>
<html lang="en">
<head>
    {include file='public/header' /}
    <!-- Bootstrap Dropify CSS -->
    <link href="__PUBLIC__/admin/vendors/bower_components/dropify/dist/css/dropify.min.css" rel="stylesheet" type="text/css"/>
    <!-- Custom CSS -->
    {include file='public/comn_css' /}
</head>
<body>
<!--Preloader-->
<div class="preloader-it">
    <div class="la-anim-1"></div>
</div>
<!--/Preloader-->
<div class="wrapper  theme-5-active pimary-color-blue">

    <!-- Top Menu Items -->
    {include file='public/top_menu' /}
    <!-- /Top Menu Items -->

    <!-- Left Sidebar Menu -->
    {include file='public/sidebar' /}
    <!-- /Left Sidebar Menu -->

    <!-- Main Content -->
    <div class="page-wrapper">
        <div class="container-fluid">
            <!-- Title -->
            <div class="row heading-bg">
                <div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
                    <h5 class="txt-dark">栏目管理</h5>
                </div>
                <!-- Breadcrumb -->
                <div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
                    <ol class="breadcrumb">
                        <li><a href="{:url('admin/index/index')}">系统首页</a></li>
                        <li><a href="{:url('admin/category/index')}">栏目管理</a></li>
                        <li class="active"><span>添加栏目</span></li>
                    </ol>
                </div>
                <!-- /Breadcrumb -->
            </div>
            <!-- /Title -->

            <!-- Row -->
            <div class="row">
                <div class="col-lg-12 col-sm-12">
                    <div class="panel panel-default card-view">
                        <div class="panel-wrapper collapse in">
                            <div class="panel-body">
                                <div  class="pills-struct">
                                    <ul role="tablist" class="nav nav-pills" id="myTabs_6">
                                        <li class="active" role="presentation"><a aria-expanded="true"  data-toggle="tab" role="tab" id="tab_1" href="#tab_tab_1">基本信息</a></li>
                                        <li role="presentation"><a aria-expanded="true"  data-toggle="tab" role="tab" id="tab_2" href="#tab_tab_2">高级设置</a></li>
                                    </ul>
                                    <div class="tab-content" id="myTabContent_6">
                                        <div  id="tab_tab_1" class="tab-pane fade active in" role="tabpanel">
                                            <form class="form-horizontal" method="post" id="system_form"  action="{:url('doAdd')}">
                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2" for="parentid">所属栏目:</label>
                                                    <div class="col-sm-8">
                                                        <select class="form-control" name="parentid" id="parentid" form="system_form" required>
                                                            <option value="0" {eq name="parentid" value="0"}selected="selected"{/eq} >顶级分类</option>
                                                            {notempty name='list'}
                                                            {foreach name='list' item='value'}
                                                            <option value="{$value.id}" {eq name="parentid" value="$value['id']"}selected="selected"{/eq}>
                                                                {notempty name='value.parentid'}
                                                                {for start="0" end="$value._level-1" step="1" name="i" }
                                                                &nbsp;&nbsp;
                                                                {/for}
                                                                └
                                                                {/notempty}
                                                                {$value.title}
                                                            </option>
                                                            {/foreach}
                                                            {/notempty}
                                                        </select>
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2" for="title">栏目名称:</label>
                                                    <div class="col-sm-8">
                                                        <input type="text" class="form-control" name="title" id="title" placeholder="请输入 栏目名称" required  form="system_form">
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2" for="other_name">栏目别名:</label>
                                                    <div class="col-sm-8">
                                                        <input type="text" class="form-control" name="other_name" id="other_name" placeholder="请输入 栏目别名" form="system_form" >
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2" for="thumb">缩略图:</label>
                                                    <div class="col-sm-8">
                                                        <input type="file" name="thumb" id="thumb" data-max-file-size="{$Think.config.img_size}M" data-max-file-size-preview="{$Think.config.img_size}M" data-allowed-file-extensions="{$Think.config.img_type}" data-errors-position="outside" class="dropify"  form="system_form" />
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2" for="url">跳转链接:</label>
                                                    <div class="col-sm-8">
                                                        <input type="text" class="form-control" name="url" id="url" placeholder="请输入 跳转链接"  form="system_form" >
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2" for="description">栏目描述:</label>
                                                    <div class="col-sm-8">
                                                        <textarea class="form-control" name="description" id="description" cols="30" rows="5" form="system_form" placeholder="请输入 栏目描述"></textarea>
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2" for="type">栏目类型:</label>
                                                    <div class="col-sm-8">
                                                        <select class="form-control" name="type" id="type" form="system_form" required>
                                                            <option value="1">列表栏目</option>
                                                            <option value="2">单页</option>
                                                        </select>
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2" for="sort">排序:</label>
                                                    <div class="col-sm-8">
                                                        <input type="text" class="form-control" name="sort" id="sort" placeholder="请输入 排序"  form="system_form" required value="{$sort}" >
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2">是否显示</label>
                                                    <div class="col-sm-8">
                                                        <div class="radio radio-info">
                                                            <input type="radio" name="is_show" id="radio3" value="1" checked=""  form="system_form">
                                                            <label for="radio3">
                                                                显示
                                                            </label>
                                                        </div>
                                                        <div class="radio radio-info">
                                                            <input type="radio" name="is_show" id="radio4" value="0"  form="system_form">
                                                            <label for="radio4">
                                                                隐藏
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2">栏目属性</label>
                                                    <div class="col-sm-8">
                                                        <div class="radio radio-info">
                                                            <input type="radio" name="attr" id="radio5" value="1" form="system_form">
                                                            <label for="radio3">
                                                                封面页
                                                            </label>
                                                        </div>
                                                        <div class="radio radio-info">
                                                            <input type="radio" name="attr" id="radio6" value="0" checked="" form="system_form">
                                                            <label for="radio4">
                                                                列表页
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                            </form>
                                        </div>
                                        <div  id="tab_tab_2" class="tab-pane fade" role="tabpanel">
                                            <form class="form-horizontal" method="post">

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2" for="seo_title">seo 标题:</label>
                                                    <div class="col-sm-8">
                                                        <input type="text" class="form-control" name="seo_title" id="seo_title" placeholder="请输入 seo 标题"  form="system_form" >
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2" for="seo_keywords">seo 关键字:</label>
                                                    <div class="col-sm-8">
                                                        <textarea class="form-control" name="seo_keywords" id="seo_keywords" cols="30" rows="5" form="system_form" placeholder="请输入 seo关键字"></textarea>
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2" for="seo_desc">seo 描述:</label>
                                                    <div class="col-sm-8">
                                                        <textarea class="form-control" name="seo_desc" id="seo_desc" cols="30" rows="5" form="system_form" placeholder="请输入 seo描述"></textarea>
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2" for="list_tpl">列表页模版:</label>
                                                    <div class="col-sm-8">
                                                        <input type="text" class="form-control" name="list_tpl" id="list_tpl" placeholder="请输入 列表页模版名称"  form="system_form" value="list" required >
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="control-label mb-10 col-sm-2" for="article_tpl">文章页模版:</label>
                                                    <div class="col-sm-8">
                                                        <input type="text" class="form-control" name="article_tpl" id="article_tpl" placeholder="请输入 文章页模版名称"  form="system_form" value="article" required >
                                                    </div>
                                                </div>
                                            </form>
                                        </div>
                                        <div class="form-group mb-0">
                                            <div class="col-sm-offset-2 col-sm-10">
                                                <button type="submit" class="btn btn-success" form="system_form"><span class="btn-text">保存设置</span></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /Row -->

        </div>
        <!-- Footer -->
        {include file='public/footer' /}
        <!-- /Footer -->

    </div>
    <!-- /Main Content -->

</div>
<!-- /#wrapper -->

<!-- JavaScript -->

<!-- jQuery -->
<script src="__PUBLIC__/admin/vendors/bower_components/jquery/dist/jquery.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="__PUBLIC__/admin/vendors/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

<!-- Bootstrap Daterangepicker JavaScript -->
<script src="__PUBLIC__/admin/vendors/bower_components/dropify/dist/js/dropify.js"></script>
<script>
    $('.dropify').dropify({
        messages: {
            'default': '拖拽文件或点击',
            'replace': '拖拽或点击覆盖',
            'remove':  '移除',
            'error':   '文件添加错误'
        },
        error: {
            'fileSize': '文件太大 (最大 {{ value }}).',
            'minWidth': '图片宽度太小 (最小 {{ value }}}px).',
            'maxWidth': '图片宽度太大 (最大 {{ value }}}px).',
            'minHeight': '图片高度太小 (最小 {{ value }}}px).',
            'maxHeight': '图片高度太大 (最大 {{ value }}px).',
            'imageFormat': '不被允许图片格式 (允许 {{ value }}).',
            'fileExtension': '非法文件 (允许 {{ value }}).'
        },
    });
</script>
<!-- Form Flie Upload Data JavaScript -->
<!--<script src="__PUBLIC__/admin/dist/js/form-file-upload-data.js"></script>-->

<!-- Slimscroll JavaScript -->
<script src="__PUBLIC__/admin/dist/js/jquery.slimscroll.js"></script>

<!-- Fancy Dropdown JS -->
<script src="__PUBLIC__/admin/dist/js/dropdown-bootstrap-extended.js"></script>

<!-- Owl JavaScript -->
<script src="__PUBLIC__/admin/vendors/bower_components/owl.carousel/dist/owl.carousel.min.js"></script>

<!-- Switchery JavaScript -->
<script src="__PUBLIC__/admin/vendors/bower_components/switchery/dist/switchery.min.js"></script>

<!-- Init JavaScript -->
{include file='public/comn_js' /}

<script src="__PUBLIC__/admin/dist/js/jquery.form.js"></script>
<script src="__PUBLIC__/admin/vendors/layer/layer.js"></script>
<script>
    $('#system_form').submit(function() {
        var index;
        // submit the form
        $(this).ajaxSubmit({
            beforeSubmit: function () {
                index = layer.load(1, {shade:[0.6, '#000']});
            },
            success: function (responseText, statusText) {
                if (responseText.status)
                {
                    layer.msg('添加成功！', {shade: [0.6, '#000'], time:3000}, function () {
                        window.location.href="{:url('index')}";
                    });
                } else {
                    layer.msg(responseText.msg, {shade: [0.6, '#000'], time:3000}, function () {
                        $('#system_form')[0].reset();
                    });
                }
            }
        });
        // return false to prevent normal browser submit and page navigation
        return false;
    });
</script>
</body>
</html>